/**
 * cors跨域处理 中间件
 * @param {import('koa').ParameterizedContext} ctx
 * @param {import('koa').Next} next
 * @returns {Promise<*>}
 */
export const cors = async (ctx, next) => {
    ctx.set('Access-Control-Allow-Origin', '*')
    ctx.set(
        'Access-Control-Allow-Headers',
        'Content-Type,Content-Length,token,Accept,X-Requested-With',
    )
    ctx.set('Access-Control-Allow-Methods', 'PUT,POST,GET,DELETE,OPTIONS')
    await next()
}
